package com.test;

import org.quartz.CronExpression;
import org.quartz.CronTrigger;
import org.quartz.JobDetail;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
import org.quartz.impl.StdSchedulerFactory;

public class StartClass {

	public static void main(String[] args) {
		try {
			task();
		} catch (SchedulerException e) {
			
			e.printStackTrace();
		}
	}

	public static void task() throws SchedulerException {

		

		SchedulerFactory schedulerFactory = new StdSchedulerFactory();

	

		Scheduler scheduler = schedulerFactory.getScheduler();

	

		long ctime = System.currentTimeMillis();

		

		JobDetail jobDetail =

		new JobDetail("jobDetail2", "jobDetailGroup2", Test.class);

		

		CronTrigger cronTrigger = new CronTrigger("cronTrigger",
				"triggerGroup2");

		try {

			

			CronExpression cexp = new CronExpression("0/5 * * * * ?");

			

			cronTrigger.setCronExpression(cexp);

		} catch (Exception e) {

			e.printStackTrace();

		}

		

		scheduler.scheduleJob(jobDetail, cronTrigger);

		

		scheduler.start();

	}
}
